package org.dzq.designmode.prototype;

import org.dzq.designmode.prototype.bean.Student;

/**
 * @ClassName: PrototypeTest
 * @Package: org.dzq.designmode.prototype
 * @author: 越
 * @date: 2023/6/12 22:10
 * @Description:
 */
public class PrototypeTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        DeepClonePrototype deepClonePrototype = new DeepClonePrototype();
        Student deepStudent = new Student();
        deepClonePrototype.setStudent(deepStudent);
        deepClonePrototype.setAge(20);
        deepClonePrototype.setName("tlz");
        DeepClonePrototype deepClonePrototype2 = deepClonePrototype.clone();
        DeepClonePrototype deepClonePrototype3 = deepClonePrototype.deepClone();
        System.out.println(deepClonePrototype);
        System.out.println(deepClonePrototype2);
        System.out.println(deepClonePrototype3);


        ShallowClonePrototype shallowClonePrototype = new ShallowClonePrototype();
        Student shallowStudent = new Student();
        shallowClonePrototype.setStudent(shallowStudent);
        shallowClonePrototype.setAge(21);
        shallowClonePrototype.setName("dzq");
        ShallowClonePrototype shallowClonePrototype2 = shallowClonePrototype.clone();
        System.out.println(shallowClonePrototype);
        System.out.println(shallowClonePrototype2);

    }
}
